// components/like/like.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    like:Boolean,
    count:Number
  },

  /**
   * 组件的初始数据
   */
  data: {
      trueLike:'images/trueLike.png',
      falseLike: 'images/falseLike.png',
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onLike() {
      let count=this.properties.count;
      count=this.properties.like ? count - 1 : count + 1
      this.setData({
        count:count,
        like:!this.properties.like
      })
      let behavier = this.properties.like?'like':'cancel'
      this.triggerEvent('like',{
        behavier: behavier
      },{})
    }
  }
})
